const isBinaryFile = require('isbinaryfile').isBinaryFile
const isBinaryFileSync = require('isbinaryfile').isBinaryFileSync
const fs = require('fs')

const filename = 'create-overall.png'
// const filename = 'package.json'
const data = fs.readFileSync(filename)
const stat = fs.lstatSync(filename)

isBinaryFile(data, stat.size).then(result => {
  if (result) {
    console.log('It is binary!')
  } else {
    console.log('No it is not.')
  }
})

const bytes = fs.readFileSync(filename)
const size = fs.lstatSync(filename).size
// console.log(` bytes:${bytes}`) file binary
// console.log(`size:${size} ;`) file size
console.log(isBinaryFileSync(bytes, size)) // true or false
